<template>
  <div class="user-profile-component">
    <div class="d-flex align-items-center">
      <img
        :src="fitUrl"
        :alt="user.nickName"
        class="rounded-circle img-thumbnail"
      />
      <div class="detail ms-2">
        <h6 class="d-block mb-0">{{ user.nickName }}</h6>
        <span class="text-truncate text-muted d-block" v-if="user.description">
          {{ user.description }}
        </span>
      </div>
    </div>
  </div>
</template>
<script lang="ts">
import { computed, defineComponent, PropType } from 'vue'
import { resetImagesStyle } from '@/utils'
import { IUserProp } from '@/types'
export default defineComponent({
  name: 'PostsAuthor',
  props: {
    user: {
      type: Object as PropType<IUserProp>,
      required: true
    }
  },
  setup(props) {
    const fitUrl = computed(() => {
      const avatar = resetImagesStyle(props.user.avatar, 50, 50)
      return avatar.fitUrl
    })
    return {
      fitUrl
    }
  }
})
</script>
